package controllers

import (
	"net/http"
	"github.com/gin-gonic/gin"
	"TeacherManager/system"
	"TeacherManager/common"
)

const (
	SESSION_KEY          = "UserID"       // session key
	CONTEXT_USER_KEY     = "User"         // context user key
	SESSION_GITHUB_STATE = "GITHUB_STATE" // github state session key
	SESSION_CAPTCHA      = "GIN_CAPTCHA"  // captcha session key
)

func Handle404(c *gin.Context) {
	HandleMessage(c, false, "404 not found")
}

func HandleForbid(c *gin.Context) {
	HandleMessage(c, true, "403 Forbid")
}
func HandleMessage(c *gin.Context, Isforbid bool, Message string) {
	c.HTML(http.StatusNotFound, "error/error.html", gin.H{
		"Isforbid": Isforbid,
		"Message":  Message,
	})
}
func sendMail(to, subject, body string) error {
	c := system.GetConfiguration()
	return common.SendToMail(c.SmtpUsername, c.SmtpPassword, c.SmtpHost, to, subject, body, "html")
}

/*func __sendMail(to, subject, body string) error {
	return nil
}*/
